package com.example.assignment7.service;

import com.example.assignment7.dao.BookDao;
import com.example.assignment7.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserDao userDao;

    @Autowired
    BookDao bookDao;

    @Override
    public String register(String name) {
        if(name ==null) {
            throw new RuntimeException("name cannot be null");
        }
        userDao.save(name);
        bookDao.save();
        return name;
    }

    @Override
    public String unegister(String name) {
        userDao.save(name);
        bookDao.save();
        return name;
    }
}
